<?php 
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <link rel="stylesheet" type="text/css" media="all" href="recursos/css/general.css" />
        <link rel="stylesheet" type="text/css" media="all" href="recursos/jqtransform/jqtransform.css" />
        <link rel="stylesheet" type="text/css" media="all" href="recursos/css/smoothness/jquery-ui-1.8.custom.css" />

        <script type="text/javascript" language="javascript" src="recursos/js/jquery.js" ></script>
        <script type="text/javascript" language="javascript" src="recursos/js/jquery-ui.js" ></script>
        <script type="text/javascript" language="javascript" src="recursos/jqtransform/jquery.jqtransform.js" ></script>

        <style type="text/css">
            label, input { display:block; }
            input.text { margin-bottom:12px; width:95%; padding: .4em; }
            .ui-dialog .ui-state-error { padding: .3em; }
            .validateTips { border: 1px solid transparent; padding: 0.3em; }
        </style>

        <title>SysDesk</title>
        <script type="text/javascript">

            $(function(){
                $('#topMenu').load("controladores/controladorMenus.php");
                $("#dialog").dialog("destroy");
                $("#dialog-form").dialog({autoOpen: false,
                    height: 300,
                    width: 350,
                    modal: true,
                    buttons: {
                        'Entrar': function() {
                            var usuario = $('#usuario').val();
                            var clave = $('#clave').val();
                            $('#topMenu').empty().html('<center><img src="recursos/imagenes/loader.gif" /></center>');
                            $('#topMenu').load('controladores/controladorLogin.php?enviar=true&usuario='+usuario+'&clave='+clave,{},
                            function(){
                                $('#topMenu').load('controladores/controladorMenus.php');
                            });
                            $("#dialog-form").dialog("close");
                            
                        }
                    },
                    close: function() {
                        $("#usuario").val("");
                        $("#clave").val("");
                    }
                });
            });

            function cargando(id){
                $('#'+id).empty().html('<center><img src="recursos/imagenes/loader.gif" /></center>');
            }

            function loadContenido(destino,pagina){
                if($('#linkPrincipal').hasClass('current_page_item')){
                    $('#linkPrincipal').removeClass('current_page_item');
                }
                else if ($('#linkCrear').hasClass('current_page_item')){
                    $('#linkCrear').removeClass('current_page_item');
                }
                else if ($('#linkAbiertos').hasClass('current_page_item')){
                    $('#linkAbiertos').removeClass('current_page_item');
                }
                else if ($('#linkCerrados').hasClass('current_page_item')){
                    $('#linkCerrados').removeClass('current_page_item');
                }

                $('#'+destino).addClass('current_page_item');
                $('#content').empty().html('<center><img src="recursos/imagenes/loader.gif" /><br/><br/>Cargando...</center>');
                $('#content').load(pagina);
            }
        </script>
    </head>
    <body onload="loadContenido('linkPrincipal','inicio.php');">
        <script type="text/javascript">

        </script>
        <div id="dialog-form" title="Iniciar Sesion">
            <form action="" method="post">
                <label for="name">Usuario</label>
                <input type="text" name="usuario" id="usuario" class="text ui-widget-content ui-corner-all" />
                <label for="password">Clave</label>
                <input type="password" name="clave" id="clave" value="" class="text ui-widget-content ui-corner-all" />
            </form>
        </div>
        <div id="contenedor">
            <div id="cabecera">
                <h1>SysDesk</h1>Soluciones Informaticas
            </div>
            <div id="topMenu">

            </div>
            <div class="clear"></div>
            <div id="content">
            </div>
        </div>

        <div style="margin-top: 20px;">
            Creado por: Alejandro de Arriba, Gabriel Perez, Carlos Lenon
        </div>
    </body>

</html>
